package com.cefa.edu.dao;

import com.cefa.edu.model.ScoreChainData;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.HashMap;

/**
 * Created by cc664 on 2018/8/8.
 */
@Mapper
public interface ScoreChainDataMapper {

    //根据成绩id 获取对应的上链数据
    @Select({"select cd.* from cefa_edu_block_chain_data cd where cd.data_id=#{scoreId}"})
    @Results(id ="chainMap",value={
            @Result(property = "id",column = "id"),
            @Result(property = "dataType",column = "data_type"),
            @Result(property = "dataId",column = "data_id"),
            @Result(property = "blockHash",column = "block_hash"),
            @Result(property = "blockHeight",column = "block_height"),
            @Result(property = "transactionHash",column = "transaction_hash"),
            @Result(property = "chainTime",column = "chain_time"),
            @Result(property = "dataHash",column = "data_hash")
    })
    HashMap<String,Object> getChainDataByScoreId(Integer scoreId);

}
